
#ifndef _LOGIC_H
#define _LOGIC_H

#define SUPPORT_WATCHDOG

#define SUPPPORT_ENCRYPTION

#define MATCH_TIME_OUT_LEN 24000

typedef enum
{
	LOGIC_CHECK_SWITCH = 0,
	LOGIC_SAMPLE_BATTARY,
	LOGIC_WAIT_WIRELESS_IDLE,
	LOGIC_SLEEP,
	LOGIC_WAIT_WAKEUP,
	LOGIC_MAX_STEP
}EnumLogicRunStep;

typedef enum
{
	SHOW_LOCAL_ADDRESS = 0,
	SHOW_PANID,
	SHOW_CHANNEL,
	SHOW_TX_POWER,
	SHOW_BATTARY_PERCENT,
	SHOW_SWITCH_STATUS,
	SHOW_RSSI,
	SHOW_MAX_TYPE
}EnumScrollShowType;

typedef struct
{
	unsigned short int OldValue;
	unsigned short int NewValue;
}StructEncryptionValue;
extern StructEncryptionValue gsEncryptionValue;

void LogicInit(void);
void TestSwitchUartOutput(void);
void LogicExecute(void);
void LCDScrollShowParameter(void);

void WirelessUploadParameter(void);
void WirelessMatchCodeInit(void);

void KeyPushDownExecuteFunction(void);

void WirelessExitMatchCode(void);

void StartTimer2(unsigned short int xus);
void StopTimer2(void);

void WirelessMatchLCDShow(void);

void WirelessLCDShowGood(void);
void WirelessUploadParameterInit(void);

void IWDGInit(void);

void SaveEncryptionToEEPROM(void);
void ReadEncryptionToEEPROM(void);

void LCDShowSwitchStatus(void);

void WirelessLCDShowNo(void);

void WirelessUploadHeart(void);

#endif
